fix5
Browse files
app.py
CHANGED
|
@@ -42,31 +42,24 @@ def get_completion_from_messages(input, model="gpt-3.5-turbo", temperature=0.8):
|
|
| 42 |
#get completion ํต๊ณผ ์์ผ์ ๋ต๋ณ์ป์
|
| 43 |
#์ด๋ ์ญํ ๋ถ๋ด ๋ฐ ํ๋กฌํํธ ์์ง๋์ด๋ง ์งํ
|
| 44 |
####
|
| 45 |
-
class
|
| 46 |
def __init__(self):
|
| 47 |
# Initialize the ChatBot class with an empty history
|
| 48 |
self.history = []
|
| 49 |
|
| 50 |
def predict(self, user_input):
|
| 51 |
-
|
| 52 |
response_text =get_completion_from_messages(user_input, temperature=0.8)
|
|
|
|
| 53 |
|
| 54 |
-
return response_text # Return the generated response
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
bot = ChatBot()
|
| 58 |
|
|
|
|
| 59 |
title = "์์์๊ธฐ๋ฐ ๋ฉด์ ์๋ฎฌ๋ ์ด์
chat bot (this template based on Tonic's MistralMed Chat)"
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
# "You are a medicine and public health expert, you will receive a question, answer the question, and provide a complete answer"]]
|
| 63 |
-
|
| 64 |
-
iface = gr.Interface(
|
| 65 |
-
fn=bot.predict,
|
| 66 |
title=title,
|
| 67 |
-
inputs=
|
| 68 |
outputs="text",
|
| 69 |
-
|
| 70 |
)
|
| 71 |
|
| 72 |
-
|
|
|
|
| 42 |
#get completion ํต๊ณผ ์์ผ์ ๋ต๋ณ์ป์
|
| 43 |
#์ด๋ ์ญํ ๋ถ๋ด ๋ฐ ํ๋กฌํํธ ์์ง๋์ด๋ง ์งํ
|
| 44 |
####
|
| 45 |
+
class Interviewer:
|
| 46 |
def __init__(self):
|
| 47 |
# Initialize the ChatBot class with an empty history
|
| 48 |
self.history = []
|
| 49 |
|
| 50 |
def predict(self, user_input):
|
|
|
|
| 51 |
response_text =get_completion_from_messages(user_input, temperature=0.8)
|
| 52 |
+
return response_text
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
inter = Interviewer()
|
| 56 |
title = "์์์๊ธฐ๋ฐ ๋ฉด์ ์๋ฎฌ๋ ์ด์
chat bot (this template based on Tonic's MistralMed Chat)"
|
| 57 |
+
chatbot = gr.Interface(
|
| 58 |
+
fn=inter.predict,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
title=title,
|
| 60 |
+
inputs="text",
|
| 61 |
outputs="text",
|
| 62 |
+
|
| 63 |
)
|
| 64 |
|
| 65 |
+
chatbot.launch()
|