ahed9x commited on
Commit
a4ef793
1 Parent(s): acaed2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,12 +6,16 @@ tokenizer = AutoTokenizer.from_pretrained("mohamedtolba/franco-arabics")
6
  model = AutoModelForSeq2SeqLM.from_pretrained("mohamedtolba/franco-arabics")
7
 
8
  def translate_text(text):
 
9
  # Tokenize the input text
10
  inputs = tokenizer(text, return_tensors="pt", truncation=True)
 
11
  # Generate the output text
12
  outputs = model.generate(**inputs)
 
13
  # Decode the generated text
14
  translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
 
15
  return translated_text
16
 
17
  # Create the Gradio interface
@@ -25,4 +29,3 @@ iface = gr.Interface(
25
 
26
  if __name__ == "__main__":
27
  iface.launch()
28
-
 
6
  model = AutoModelForSeq2SeqLM.from_pretrained("mohamedtolba/franco-arabics")
7
 
8
  def translate_text(text):
9
+ print(f"Input text: {text}")
10
  # Tokenize the input text
11
  inputs = tokenizer(text, return_tensors="pt", truncation=True)
12
+ print(f"Tokenized inputs: {inputs}")
13
  # Generate the output text
14
  outputs = model.generate(**inputs)
15
+ print(f"Generated outputs: {outputs}")
16
  # Decode the generated text
17
  translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
18
+ print(f"Translated text: {translated_text}")
19
  return translated_text
20
 
21
  # Create the Gradio interface
 
29
 
30
  if __name__ == "__main__":
31
  iface.launch()