Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
|
|
|
| 3 |
|
| 4 |
print(f'{torch.cuda.is_available()=}')
|
| 5 |
|
| 6 |
-
|
| 7 |
-
return "Hello " + name + "!!"
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
+
from transformers import pipeline
|
| 4 |
|
| 5 |
print(f'{torch.cuda.is_available()=}')
|
| 6 |
|
| 7 |
+
pipe = pipeline('translation_en_to_fr', device=0)
|
|
|
|
| 8 |
|
| 9 |
+
def translate(text):
|
| 10 |
+
return pipe(text)[0]['translation_text']
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(fn=translate, inputs="text", outputs="text")
|
| 13 |
iface.launch()
|