Spaces:
Sleeping
Sleeping
Commit ·
69544e2
1
Parent(s): c923a2a
another take
Browse files
app.py
CHANGED
|
@@ -2,13 +2,13 @@ import spaces
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
pipe = pipeline(
|
|
|
|
|
|
|
| 6 |
|
| 7 |
@spaces.GPU
|
| 8 |
def translate(text):
|
| 9 |
-
|
| 10 |
-
pipe.model.to("cuda")
|
| 11 |
-
return pipe(text)[0]["translation_text"]
|
| 12 |
|
| 13 |
demo = gr.Interface(fn=translate, inputs="text", outputs="text")
|
| 14 |
demo.launch()
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
pipe = pipeline(model="ejshcwartz/decaf-v1-22b")
|
| 6 |
+
# Move pipeline to GPU inside the GPU context (if available)
|
| 7 |
+
pipe.model.to("cuda")
|
| 8 |
|
| 9 |
@spaces.GPU
|
| 10 |
def translate(text):
|
| 11 |
+
return pipe(text)[0]
|
|
|
|
|
|
|
| 12 |
|
| 13 |
demo = gr.Interface(fn=translate, inputs="text", outputs="text")
|
| 14 |
demo.launch()
|