dtrejopizzo commited on
Commit
f610717
1 Parent(s): 8b8e9c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -2,7 +2,8 @@
2
  import openai
3
  import gradio as gr
4
  from gradio import HuggingFaceDatasetSaver
5
- openai.api_key ='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'
 
6
  def openai_chat(prompt):
7
  completions = openai.Completion.create(
8
  engine="text-davinci-003",
@@ -17,12 +18,16 @@ def openai_chat(prompt):
17
 
18
  message = completions.choices[0].text
19
  return message.strip()
 
20
  def chatbot(input, history=[]):
21
  output = openai_chat(input)
22
  history.append((input, output))
23
  return history, history
24
- hf_writer = gr.HuggingFaceDatasetSaver("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", "https://huggingface.co/Meghanjali")
25
  gr.Interface(fn = chatbot,
26
  inputs = ["text",'state'],
27
  outputs = ["chatbot",'state'],
 
 
 
28
  allow_flagging="manual").launch()
 
2
  import openai
3
  import gradio as gr
4
  from gradio import HuggingFaceDatasetSaver
5
+ openai.api_key ='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'
6
+
7
  def openai_chat(prompt):
8
  completions = openai.Completion.create(
9
  engine="text-davinci-003",
 
18
 
19
  message = completions.choices[0].text
20
  return message.strip()
21
+
22
  def chatbot(input, history=[]):
23
  output = openai_chat(input)
24
  history.append((input, output))
25
  return history, history
26
+
27
  gr.Interface(fn = chatbot,
28
  inputs = ["text",'state'],
29
  outputs = ["chatbot",'state'],
30
+ examples=[["Building a translation demo with Gradio is so easy!", "eng_Latn", "spa_Latn"]],
31
+ cache_examples=False,
32
+ title="Demo app",
33
  allow_flagging="manual").launch()