File size: 640 Bytes
d89961b
f7e31e8
1838924
d89961b
d2d519d
f09b057
05011f6
d89961b
91ad58d
 
9fb4552
91ad58d
05011f6
 
91ad58d
 
 
 
 
fc2aff3
 
3914477
d89961b
24944bc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()