jayant012 commited on
Commit
781c36b
·
verified ·
1 Parent(s): 81dec1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -6,13 +6,6 @@ from langchain.output_parsers import PydanticOutputParser
6
  from langchain_openai import ChatOpenAI
7
 
8
 
9
- # with open('openai_api_key.txt') as f:
10
- # api_key = f.read()
11
-
12
- # os.environ['OPENAI_API_KEY'] = api_key
13
-
14
- # chat = ChatOpenAI()
15
-
16
  class TextTranslator(BaseModel):
17
  output_text: str = Field(description="Python string containing the output text translated in the desired language")
18
 
@@ -46,4 +39,7 @@ with gr.Blocks() as demo:
46
  inputs = [gr.Textbox(label = "Enter the text that you want to translate"), gr.Textbox(label = "Enter the language that you want it to translate to", placeholder = "Example : Hindi,French,Bengali,etc")]
47
  generate_btn = gr.Button(value = 'Generate')
48
  outputs = [gr.Textbox(label = "Translated text")]
49
- generate_btn.click(fn = text_translator, inputs= inputs, outputs = outputs)
 
 
 
 
6
  from langchain_openai import ChatOpenAI
7
 
8
 
 
 
 
 
 
 
 
9
  class TextTranslator(BaseModel):
10
  output_text: str = Field(description="Python string containing the output text translated in the desired language")
11
 
 
39
  inputs = [gr.Textbox(label = "Enter the text that you want to translate"), gr.Textbox(label = "Enter the language that you want it to translate to", placeholder = "Example : Hindi,French,Bengali,etc")]
40
  generate_btn = gr.Button(value = 'Generate')
41
  outputs = [gr.Textbox(label = "Translated text")]
42
+ generate_btn.click(fn = text_translator, inputs= inputs, outputs = outputs)
43
+
44
+ if __name__ == '__main__':
45
+ demo.launch()