Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
qa_modelo = pipeline("question-answering", "deepset/roberta-base-squad2") | |
contextos = { | |
"1. When was Corinthians founded?": "Corinthians was founded on September 1, 1910.", | |
"2. Who founded Corinthians?": "It was founded by a group of five workers from the Bom Retiro neighborhood in São Paulo.", | |
"3. Why is the club called Corinthians?": "The name was inspired by the English team Corinthian Football Club, which toured Brazil in 1910.", | |
"4. What are Corinthians' main nicknames?": "The most popular nicknames are 'Timão,' 'Coringão,' and 'The People's Team.'", | |
"5. What are the club's official colors?": "The official colors are black and white.", | |
"6. What is the name of Corinthians' stadium?": "The stadium is called Neo Química Arena, located in São Paulo.", | |
"7. How many Brazilian Championships has Corinthians won?": "Corinthians has won 7 Brazilian Championships.", | |
"8. What is Corinthians' biggest international achievement?": "Corinthians won the FIFA Club World Cup twice, in 2000 and 2012.", | |
"9. Who are Corinthians' biggest rivals?": "The biggest rivals are Palmeiras, São Paulo, and Santos.", | |
"10. What is the 'Derby Paulista'?": "The 'Derby Paulista' is the match between Corinthians and Palmeiras, one of Brazil's biggest football rivalries.", | |
"11. What was the first major title Corinthians won?": "The first major title was the Paulista Championship in 1914.", | |
"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.", | |
"13. Who was the key player in the 'Democracia Corinthiana' movement?": "Sócrates, one of Corinthians' greatest players, led the movement.", | |
"14. What year did Corinthians win the Copa Libertadores?": "Corinthians won the Copa Libertadores in 2012.", | |
"15. Who scored the goal in the 2012 FIFA Club World Cup final?": "Peruvian striker Paolo Guerrero scored the winning goal against Chelsea.", | |
"16. How many Paulista Championships has Corinthians won?": "Corinthians has won 30 Paulista Championships.", | |
"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.", | |
"18. What are Corinthians fans called?": "Corinthians' fans are known as 'Fiel,' meaning 'The Faithful.'", | |
"19. How many fans does Corinthians have?": "Corinthians has approximately 30 million fans, making it one of the largest fanbases in Brazil.", | |
"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.", | |
"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.", | |
"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.", | |
"23. Who is considered Corinthians' greatest idol?": "Many consider Roberto Rivellino and Sócrates as the club’s greatest idols.", | |
"24. What was Corinthians’ performance in the 2012 Copa Libertadores?": "Corinthians won the 2012 Copa Libertadores undefeated, a historic achievement for the club.", | |
"25. What is the club's mascot?": "Corinthians' mascots are the Mosqueteiro (Musketeer) and São Jorge (Saint George).", | |
"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.", | |
"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.", | |
"28. How many times has Corinthians won the Copa do Brasil?": "Corinthians has won the Copa do Brasil 3 times.", | |
"29. When did Corinthians inaugurate their current stadium?": "The Neo Química Arena was inaugurated in 2014.", | |
"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." | |
} | |
def respondendo_faq(pergunta): | |
contexto = contextos[pergunta] | |
resultado = qa_modelo(question=pergunta, context=contexto) | |
return resultado['answer'] | |
app = gr.Interface( | |
fn=respondendo_faq, | |
inputs=gr.Dropdown(choices=list(contextos.keys()), label="Select your question"), | |
outputs='text', | |
title='FAQ - Vai Corinthians', | |
description='Select a question to get an answer from our FAQ.') | |
if __name__ == "__main__": | |
app.launch(share=True) | |