marioluciofjr commited on
Commit
342bc5c
·
verified ·
1 Parent(s): 0c04966

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -0
app.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install -q -U gradio
2
+ from transformers import pipeline
3
+ import gradio as gr
4
+
5
+ qa_modelo = pipeline("question-answering", "deepset/roberta-base-squad2")
6
+
7
+ contextos = {
8
+ "1. When was Corinthians founded?": "Corinthians was founded on September 1, 1910.",
9
+ "2. Who founded Corinthians?": "It was founded by a group of five workers from the Bom Retiro neighborhood in São Paulo.",
10
+ "3. Why is the club called Corinthians?": "The name was inspired by the English team Corinthian Football Club, which toured Brazil in 1910.",
11
+ "4. What are Corinthians' main nicknames?": "The most popular nicknames are 'Timão,' 'Coringão,' and 'The People's Team.'",
12
+ "5. What are the club's official colors?": "The official colors are black and white.",
13
+ "6. What is the name of Corinthians' stadium?": "The stadium is called Neo Química Arena, located in São Paulo.",
14
+ "7. How many Brazilian Championships has Corinthians won?": "Corinthians has won 7 Brazilian Championships.",
15
+ "8. What is Corinthians' biggest international achievement?": "Corinthians won the FIFA Club World Cup twice, in 2000 and 2012.",
16
+ "9. Who are Corinthians' biggest rivals?": "The biggest rivals are Palmeiras, São Paulo, and Santos.",
17
+ "10. What is the 'Derby Paulista'?": "The 'Derby Paulista' is the match between Corinthians and Palmeiras, one of Brazil's biggest football rivalries.",
18
+ "11. What was the first major title Corinthians won?": "The first major title was the Paulista Championship in 1914.",
19
+ "12. What is 'Democracia Corinthiana'?": "'Democracia Corinthiana' was a unique period in the 1980s when the players had a say in the club's decisions.",
20
+ "13. Who was the key player in the 'Democracia Corinthiana' movement?": "Sócrates, one of Corinthians' greatest players, led the movement.",
21
+ "14. What year did Corinthians win the Copa Libertadores?": "Corinthians won the Copa Libertadores in 2012.",
22
+ "15. Who scored the goal in the 2012 FIFA Club World Cup final?": "Peruvian striker Paolo Guerrero scored the winning goal against Chelsea.",
23
+ "16. How many Paulista Championships has Corinthians won?": "Corinthians has won 30 Paulista Championships.",
24
+ "17. What is the significance of the 1977 Paulista Championship?": "It ended a 23-year title drought for Corinthians, making it one of the club's most celebrated victories.",
25
+ "18. What are Corinthians fans called?": "Corinthians' fans are known as 'Fiel,' meaning 'The Faithful.'",
26
+ "19. How many fans does Corinthians have?": "Corinthians has approximately 30 million fans, making it one of the largest fanbases in Brazil.",
27
+ "20. What does the club’s crest represent?": "The crest features a pair of oars and an anchor, symbolizing the club’s roots in rowing and football.",
28
+ "21. What happened during the 'Invasão Corinthiana'?": "In 1976, over 70,000 Corinthians fans traveled to Rio de Janeiro to support the team in a match against Fluminense, a historic fan movement.",
29
+ "22. Who was the first player to be called up to the Brazilian national team from Corinthians?": "Amílcar Barbuy was the first Corinthians player to represent Brazil.",
30
+ "23. Who is considered Corinthians' greatest idol?": "Many consider Roberto Rivellino and Sócrates as the club’s greatest idols.",
31
+ "24. What was Corinthians’ performance in the 2012 Copa Libertadores?": "Corinthians won the 2012 Copa Libertadores undefeated, a historic achievement for the club.",
32
+ "25. What is the club's mascot?": "Corinthians' mascots are the Mosqueteiro (Musketeer) and São Jorge (Saint George).",
33
+ "26. What is the 'Clássico Majestoso'?": "It’s the match between Corinthians and São Paulo FC, one of São Paulo’s major football rivalries.",
34
+ "27. Who holds the record for most goals scored for Corinthians?": "The record is held by Cláudio Christovam de Pinho, who scored 306 goals for the club.",
35
+ "28. How many times has Corinthians won the Copa do Brasil?": "Corinthians has won the Copa do Brasil 3 times.",
36
+ "29. When did Corinthians inaugurate their current stadium?": "The Neo Química Arena was inaugurated in 2014.",
37
+ "30. What makes Corinthians one of Brazil’s most popular clubs?": "Corinthians has deep roots in the working-class community, and its passionate fanbase, the 'Fiel,' makes it a club with unmatched support and history."
38
+ }
39
+
40
+ def respondendo_faq(pergunta):
41
+ contexto = contextos[pergunta]
42
+ resultado = qa_modelo(question=pergunta, context=contexto)
43
+ return resultado['answer']
44
+
45
+ app = gr.Interface(
46
+ fn=respondendo_faq,
47
+ inputs=gr.Dropdown(choices=list(contextos.keys()), label="Select your question"),
48
+ outputs='text',
49
+ title='FAQ - Vai Corinthians',
50
+ description='Select a question to get an answer from our FAQ.')
51
+
52
+ if __name__ == "__main__":
53
+ app.launch(share=True)