File size: 2,454 Bytes
66d63c7
c3ee309
66d63c7
c3ee309
 
 
66d63c7
c3ee309
66d63c7
1194d1e
 
 
 
 
 
 
c3ee309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ed10886
c3ee309
 
 
ed10886
1194d1e
ed10886
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()