Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update: Text
Browse files
app.py
CHANGED
|
@@ -103,7 +103,7 @@ def predict(review: str):
|
|
| 103 |
# Abort if text is not english
|
| 104 |
if not review_is_eng:
|
| 105 |
review = _translate_en(review)
|
| 106 |
-
html_out += f"""<
|
| 107 |
<p>{review}</p>
|
| 108 |
"""
|
| 109 |
is_translated = True
|
|
@@ -144,9 +144,9 @@ def random_text():
|
|
| 144 |
|
| 145 |
def _get_device_info():
|
| 146 |
if torch.cuda.is_available():
|
| 147 |
-
return f"
|
| 148 |
else:
|
| 149 |
-
return "
|
| 150 |
|
| 151 |
### Create Form interface with Gradio Framework ##################################
|
| 152 |
custom_css = """
|
|
|
|
| 103 |
# Abort if text is not english
|
| 104 |
if not review_is_eng:
|
| 105 |
review = _translate_en(review)
|
| 106 |
+
html_out += f"""<strong style='margin-bottom: 0.5em'>Your text has been automatically translated:</strong>
|
| 107 |
<p>{review}</p>
|
| 108 |
"""
|
| 109 |
is_translated = True
|
|
|
|
| 144 |
|
| 145 |
def _get_device_info():
|
| 146 |
if torch.cuda.is_available():
|
| 147 |
+
return f"◉ Runs on GPU: {torch.cuda.get_device_name(0)}"
|
| 148 |
else:
|
| 149 |
+
return "◎ Runs on CPU (May be slower)"
|
| 150 |
|
| 151 |
### Create Form interface with Gradio Framework ##################################
|
| 152 |
custom_css = """
|