Daniel-Sousa commited on
Commit
fe97c99
1 Parent(s): 384699e
Files changed (3) hide show
  1. README.md +3 -3
  2. app.py +31 -0
  3. requirements.txt +6 -0
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  title: Disaster
3
- emoji: 🦀
4
- colorFrom: indigo
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 3.50.2
8
  app_file: app.py
 
1
  ---
2
  title: Disaster
3
+ emoji: 💥
4
+ colorFrom: red
5
+ colorTo: orange
6
  sdk: gradio
7
  sdk_version: 3.50.2
8
  app_file: app.py
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
+ import torch
4
+
5
+ model_name = "Daniel-Sousa/outputs"
6
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
8
+
9
+ mapping = {
10
+ 0: 'It is not a disaster',
11
+ 1: 'Disaster',
12
+ }
13
+
14
+ def predict(text):
15
+ inputs = tokenizer(text, return_tensors="pt")
16
+
17
+ outputs = model(**inputs)
18
+ predictions = outputs.logits
19
+
20
+ return mapping[round(predictions.item())]
21
+
22
+ iface = gr.Interface(
23
+ fn=predict,
24
+ inputs="text",
25
+ outputs="text",
26
+ layout="vertical",
27
+ title="Classificador de Tweets",
28
+ description="Esse modelo é capaz de realizar uma análise de frases em Inglês do Tweet e diser se ela está refenciado um desastre ou não"
29
+ )
30
+
31
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ pandas==1.4.2
2
+ Transformers==4.33.0
3
+ Pytorch==2.0.0
4
+ Datasets==2.1.0
5
+ Tokenizers==0.13.3
6
+ torch