Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import datetime
|
2 |
import streamlit as st
|
3 |
import maritalk
|
4 |
-
import time
|
5 |
|
6 |
# question = "Name the planets in the solar system? A: " # question = "Quais são os planetas do sistema solar?" # question = "Qual é o maior planeta do sistema solar?"
|
7 |
|
@@ -12,20 +11,10 @@ def init_model():
|
|
12 |
)
|
13 |
return model
|
14 |
|
15 |
-
# def chat(message, max_tokens=300):
|
16 |
-
# model = maritalk.MariTalk(
|
17 |
-
# key="100479706496023140829_534ece7d352abf00",
|
18 |
-
# model="sabia-3" # No momento, suportamos os modelos sabia-3, sabia-2-medium e sabia-2-small
|
19 |
-
# )
|
20 |
-
# for response in model.generate(message, max_tokens=max_tokens)
|
21 |
-
# answer = response["answer"]
|
22 |
-
# return answer
|
23 |
-
|
24 |
def stream_response(model, message, max_tokens=200):
|
25 |
for response in model.generate(message, max_tokens=max_tokens, stream=True):
|
26 |
if 'text' in response.keys():
|
27 |
yield response['text']
|
28 |
-
# time(0.05)
|
29 |
|
30 |
# main()
|
31 |
model = init_model()
|
|
|
1 |
import datetime
|
2 |
import streamlit as st
|
3 |
import maritalk
|
|
|
4 |
|
5 |
# question = "Name the planets in the solar system? A: " # question = "Quais são os planetas do sistema solar?" # question = "Qual é o maior planeta do sistema solar?"
|
6 |
|
|
|
11 |
)
|
12 |
return model
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
def stream_response(model, message, max_tokens=200):
|
15 |
for response in model.generate(message, max_tokens=max_tokens, stream=True):
|
16 |
if 'text' in response.keys():
|
17 |
yield response['text']
|
|
|
18 |
|
19 |
# main()
|
20 |
model = init_model()
|