Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Load the text translation pipeline with the specified model
|
5 |
+
translator = pipeline("translation", model="models/Noxus09/my_awesome_opus_books_model")
|
6 |
+
|
7 |
+
# Define the Gradio interface
|
8 |
+
iface = gr.Interface(
|
9 |
+
fn=translator, # Function to call for translation
|
10 |
+
inputs=[gr.Textbox(lines=5, placeholder="Enter English text to translate")],
|
11 |
+
outputs="textbox",
|
12 |
+
title="English to French Translator",
|
13 |
+
description="Translates English text into French using a fine-tuned OPUS-MT model.",
|
14 |
+
)
|
15 |
+
|
16 |
+
# Launch the Gradio app
|
17 |
+
iface.launch()
|