AndreasThinks commited on
Commit
1f438dd
·
verified ·
1 Parent(s): 239e535

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,14 +1,10 @@
1
- import gradio as gr
2
- import requests
3
- import os
4
-
5
- # Retrieve secrets
6
- API_URL = os.environ.get("API_URL")
7
 
8
  import gradio as gr
9
  import requests
10
  import os
 
11
 
 
12
  headers = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"}
13
 
14
  def query(payload):
@@ -36,6 +32,7 @@ def translate(text, source_lang, target_lang):
36
  })
37
 
38
  # Extract the translated text from the model output
 
39
  translated_text = output[0]['generated_text'].strip()
40
 
41
  return translated_text
 
 
 
 
 
 
 
1
 
2
  import gradio as gr
3
  import requests
4
  import os
5
+ API_URL = os.environ.get("API_URL")
6
 
7
+ # Hugging Face API configuration
8
  headers = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"}
9
 
10
  def query(payload):
 
32
  })
33
 
34
  # Extract the translated text from the model output
35
+ # Assuming the model returns just the translation without the instruction format
36
  translated_text = output[0]['generated_text'].strip()
37
 
38
  return translated_text