Julien Matuszak commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,14 +116,16 @@ def process_request(input_text):
|
|
| 116 |
# Return the translations and contexts
|
| 117 |
return translations, context_results
|
| 118 |
|
| 119 |
-
# Gradio interface
|
| 120 |
def gradio_interface(input_text):
|
| 121 |
translations, contexts = process_request(input_text)
|
| 122 |
-
|
| 123 |
-
output
|
|
|
|
| 124 |
for context, translation in translations.items():
|
| 125 |
-
output
|
| 126 |
-
|
|
|
|
|
|
|
| 127 |
|
| 128 |
# Create the Gradio interface
|
| 129 |
interface = gr.Interface(
|
|
|
|
| 116 |
# Return the translations and contexts
|
| 117 |
return translations, context_results
|
| 118 |
|
|
|
|
| 119 |
def gradio_interface(input_text):
|
| 120 |
translations, contexts = process_request(input_text)
|
| 121 |
+
|
| 122 |
+
# Format the output as a JSON-serializable list of dictionaries
|
| 123 |
+
output = []
|
| 124 |
for context, translation in translations.items():
|
| 125 |
+
output.append({"context": context.capitalize(), "text": translation})
|
| 126 |
+
|
| 127 |
+
# Return the JSON-serializable object
|
| 128 |
+
return output
|
| 129 |
|
| 130 |
# Create the Gradio interface
|
| 131 |
interface = gr.Interface(
|