Frenchizer commited on
Commit
e3aed43
·
verified ·
1 Parent(s): 0a4c508

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -116,24 +116,20 @@ def process_request(input_text):
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(
132
  fn=gradio_interface,
133
  inputs="text",
134
- outputs="json",
135
  title="Frenchizer",
136
- description="Translate text from English to French with context-specific models and different outputs."
137
  )
138
 
139
  interface.launch()
 
116
  # Return the translations and contexts
117
  return translations, context_results
118
 
119
+ # Gradio interface
120
  def gradio_interface(input_text):
121
+ translation, contexts = process_request(input_text)
122
+ # Format the output
123
+ output = f"Translation: {translation}\n"
124
+ return output.strip()
 
 
 
 
 
125
 
126
  # Create the Gradio interface
127
  interface = gr.Interface(
128
  fn=gradio_interface,
129
  inputs="text",
130
+ outputs="text",
131
  title="Frenchizer",
132
+ description="Translate text from English to French with context detection and threshold."
133
  )
134
 
135
  interface.launch()