braunaleMPG's picture
Update app.py
9fb4552 verified
raw
history blame contribute delete
640 Bytes
import gradio as gr
import modal
import time
f = modal.Function.lookup("tutor_mixtral_1000", "Model.generate")
chat_history = ""
def echo(message, history):
prompt = ""
for m in history:
prompt+="Human: "+m[0]+"\nAssistant: "+m[1]+"\n"
message = "Human: "+message+"\nAssistant: "
answer = ""
prompt += message
print("Prompt: ", prompt)
for t in f.remote_gen(prompt):
#print("Received answer after ", round(time.time()-start,3))
answer += t
yield answer
#chat_history += message+answer+"\n"
demo = gr.ChatInterface(fn=echo, title="Tutor Bot").queue()
demo.launch()