Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
# from transformers import AutoModelForCausalLM, AutoTokenizer
|
2 |
-
import time
|
3 |
-
import datetime
|
4 |
-
|
5 |
-
import streamlit as st
|
6 |
-
|
7 |
-
question = "Name the planets in the solar system? A: "
|
8 |
-
question = "Quais são os planetas do sistema solar?"
|
9 |
-
question = "Qual é o maior planeta do sistema solar?"
|
10 |
-
|
11 |
-
before = datetime.datetime.now()
|
12 |
-
|
13 |
-
from transformers import AutoTokenizer, XGLMModel
|
14 |
-
import torch
|
15 |
-
|
16 |
-
prompt = "Question: Qual é o maior planeta do sistema solar ?"
|
17 |
-
tokenizer = AutoTokenizer.from_pretrained("facebook/xglm-564M")
|
18 |
-
model = XGLMModel.from_pretrained("facebook/xglm-564M")
|
19 |
-
|
20 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
21 |
-
outputs = model(**inputs, labels=inputs["input_ids"])
|
22 |
-
|
23 |
-
last_hidden_states = outputs.last_hidden_state
|
24 |
-
|
25 |
-
output = last_hidden_states
|
26 |
-
|
27 |
-
output = tokenizer.batch_decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
28 |
-
|
29 |
-
with st.container():
|
30 |
-
st.write('\n\n')
|
31 |
-
st.write('LLM-LANAChat')
|
32 |
-
st.write('\n\n' + output)
|
33 |
-
|
34 |
-
print('saida gerada.')
|
35 |
-
print('\n\n')
|
36 |
-
|
37 |
-
after = datetime.datetime.now()
|
38 |
-
current_time = (after - before) # .strftime("%H:%M:%S")
|
39 |
-
print("\nTime Elapsed: ", current_time)
|
40 |
-
st.write("\nTime Elapsed: ", current_time)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|