Wootang01 commited on
Commit
6a3cc6f
·
1 Parent(s): 0b9525a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -19
app.py CHANGED
@@ -2,17 +2,7 @@ import os
2
  import openai
3
  import gradio as gr
4
 
5
- #openai.api_key = "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"
6
- #openai.api_key = "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"
7
  openai.api_key ="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"
8
- #openai.api_key = "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"
9
- #openai.api_key = "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"
10
- #openai.api_key = "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"
11
- #openai.api_key = "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"
12
- #openai.api_key = "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"
13
- #openai.api_key = "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"
14
- #openai.api_key = "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"
15
- #openai.api_key = "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"
16
 
17
  start_sequence = "\nAI:"
18
  restart_sequence = "\nHuman: "
@@ -21,14 +11,11 @@ def predict(input, history=[]):
21
 
22
  s = list(sum(history, ()))
23
  s.append(input)
24
- # initial_prompt="The following is a conversation with an AI movie recommendation assistant. The assistant is helpful, creative, clever, and very friendly.Along with movie recommendation it also talks about general topics"
25
- # \n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How can I help you today?\nHuman: "
26
  response = openai.Completion.create(
27
  model="text-davinci-003",
28
- #model="text-curie-001",
29
  prompt= str(s),
30
  temperature=0.9,
31
- max_tokens=150,
32
  top_p=1,
33
  frequency_penalty=0,
34
  presence_penalty=0.6,
@@ -39,8 +26,4 @@ def predict(input, history=[]):
39
 
40
  return history, history
41
 
42
- gr.Markdown("Developed by Dr.Rakeeb Jaufer")
43
- gr.Interface(fn=predict,
44
- inputs=["text",'state'],
45
-
46
- outputs=["chatbot",'state']).launch()
 
2
  import openai
3
  import gradio as gr
4
 
 
 
5
  openai.api_key ="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"
 
 
 
 
 
 
 
 
6
 
7
  start_sequence = "\nAI:"
8
  restart_sequence = "\nHuman: "
 
11
 
12
  s = list(sum(history, ()))
13
  s.append(input)
 
 
14
  response = openai.Completion.create(
15
  model="text-davinci-003",
 
16
  prompt= str(s),
17
  temperature=0.9,
18
+ max_tokens=250,
19
  top_p=1,
20
  frequency_penalty=0,
21
  presence_penalty=0.6,
 
26
 
27
  return history, history
28
 
29
+ gr.Interface(fn=predict, inputs=["text",'state'], outputs=["chatbot",'state']).launch()