Spaces:
Sleeping
Sleeping
Commit
·
ce243a5
1
Parent(s):
577b7f3
init
Browse files- app.py +33 -0
- mi_clase.py +9 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from mi_clase import persona
|
3 |
+
st.title("Ask your scientific question!")
|
4 |
+
expected_format = "What is color?\nA)Is a name.\nB)Is something horrible.\nC)I don't know.\nD)You should ask someone else.\nE)Ask in a pyshic book."
|
5 |
+
txt = st.text_area(
|
6 |
+
"follow this format while making your question:",
|
7 |
+
expected_format)
|
8 |
+
try:
|
9 |
+
lista = txt.split("E)")
|
10 |
+
e = lista[1]
|
11 |
+
lista = lista[0].split("D)")
|
12 |
+
d = lista[1]
|
13 |
+
lista = lista[0].split("C)")
|
14 |
+
c = lista[1]
|
15 |
+
lista = lista[0].split("B)")
|
16 |
+
b = lista[1]
|
17 |
+
lista = lista[0].split("A)")
|
18 |
+
a = lista[1]
|
19 |
+
q = lista[0]
|
20 |
+
|
21 |
+
mi_dict= {
|
22 |
+
"question":q,
|
23 |
+
"option A":a,
|
24 |
+
"option B":b,
|
25 |
+
"option C":c,
|
26 |
+
"option D":d,
|
27 |
+
"option E":e
|
28 |
+
}
|
29 |
+
|
30 |
+
st.write(mi_dict)
|
31 |
+
st.write(persona.nombre)
|
32 |
+
except:
|
33 |
+
st.error("Your question doesn't have the required format. Please, correct it.")
|
mi_clase.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class Persona:
|
2 |
+
def __init__(self,nombre,edad):
|
3 |
+
self.nombre = nombre
|
4 |
+
self.edad = edad
|
5 |
+
|
6 |
+
def get_nomber(self):
|
7 |
+
return self.nombre
|
8 |
+
|
9 |
+
persona = Persona("josue",33)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|