Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Define the model path in Hugging Face
|
5 |
+
model_name = "willco-afk/languages" # Ensure this is correct for your uploaded model
|
6 |
+
translator = pipeline("translation", model=model_name)
|
7 |
+
|
8 |
+
def translate(input_text):
|
9 |
+
return translator(input_text)[0]['translation_text']
|
10 |
+
|
11 |
+
# Define Gradio Interface
|
12 |
+
iface = gr.Interface(fn=translate, inputs="text", outputs="text", live=True)
|
13 |
+
|
14 |
+
iface.launch()
|