giseldo's picture
ultima versao
ed10886
raw
history blame
2.45 kB
import gradio as gr
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_classif
import pandas as pd
titulo = """CLONE - Studio Dashboard: "default" and "Default Project" does not give clear information about Alloy and Project unless description is read."""
descricao = """Steps To Reproduce: 1. On dashboard on studio 3.0, navigate to Develop tab. 2. Notice "default" and "Default Project" & "two-tabbed" and "Tabbed Application" names. Actual: User does not get clear information from names that one is alloy project and another one is Titanium project unless he reads the description below. Expected: Naming convention or icon corresponding must suggest type"""
titulo1 = """Ti.UI.Picker has no collection binding"""
descricao1 = """h3. original discussion http://developer.appcelerator.com/question/145992/databinding-on-picker h3. problem Collection binding is not implemented for Ti.UI.Picker as it is for Ti.UI.TableView and other generic Titaniums views (View, Window, ScrollView, etc...). h3. solution Support collection binding on Ti.UI.Picker just as it is on TableView. It will need special handling as the Ti.UI.Picker requires custom parsing for columns and rows. Something like this should be how it would work for devs: {code:xml} <Alloy> <Collection src="book" /> <Window class="container"> <Picker dataCollection="book"> <PickerRow title="{title}" /> </Picker> </Window> </Alloy> {code}"""
def calcula(titulo, descricao):
with open("model/model_tawos_aloy.pkl", "rb") as file:
model = pickle.load(file)
context = titulo + descricao
d = {"context": [context]}
df = pd.DataFrame(data=d, columns=["context"])
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(df["context"])
#X_new = SelectKBest(f_classif, k=50).fit_transfor(X)
story_points = model.predict(X)
return story_points
demo = gr.Interface(fn=calcula,
inputs=[gr.Textbox(placeholder="Título", label="Título"),
gr.Textbox(lines=10, placeholder="Descrição", label="Descrição")],
outputs=[gr.Textbox(label="Story Points Estimado")],
title="Agile Task Story Point Estimator - TAWOS - Alloy",
examples=[[titulo, descricao], [titulo1, descricao1]]
)
demo.launch()