Tafar commited on
Commit
8a11efc
1 Parent(s): dbae169

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -25
app.py CHANGED
@@ -2,22 +2,10 @@ import gradio as gr
2
 
3
  class TafGPT:
4
  def generate_response(self, user_input):
5
- technology_topics = {
6
- "machine learning": "Machine learning is a fascinating field that involves training computers to learn from data and make predictions.",
7
- "python programming language": "Python is a versatile programming language known for its simplicity and readability. It's widely used in various domains, including web development and data science.",
8
- "web development": "Web development includes designing and building websites. Front-end development focuses on user interfaces, while back-end development handles server-side logic.",
9
- "artificial intelligence": "Artificial Intelligence (AI) refers to the simulation of human intelligence in machines, enabling them to perform tasks that typically require human intelligence.",
10
- "data science": "Data science involves extracting insights and knowledge from structured and unstructured data. It combines expertise in statistics, mathematics, and programming.",
11
- "cybersecurity": "Cybersecurity aims to protect computer systems, networks, and data from cyber threats and attacks. It includes measures to ensure the confidentiality, integrity, and availability of information.",
12
- "cloud computing": "Cloud computing provides on-demand access to computing resources, such as storage, processing power, and databases, over the internet.",
13
- }
14
 
15
- if user_input.lower() in technology_topics:
16
- response = f"Taf-gpt: {technology_topics[user_input.lower()]}"
17
- else:
18
- response = "Taf-gpt: I'm sorry, I'm specialized in technology topics. Feel free to ask me about machine learning, Python programming language, web development, artificial intelligence, data science, cybersecurity, or cloud computing!"
19
-
20
- return f"User: {user_input}\n{Taf-gpt: {response}"
21
 
22
  # Create an instance of TafGPT
23
  taf_gpt = TafGPT()
@@ -25,17 +13,11 @@ taf_gpt = TafGPT()
25
  # Define Gradio interface
26
  iface = gr.Interface(
27
  fn=taf_gpt.generate_response,
28
- inputs=gr.Textbox(),
29
- outputs=gr.Textbox(),
30
  live=True,
31
- title="Taf-gpt Technology Chatbot",
32
- description="Explore technology topics with Taf-gpt! Choose a predefined topic or ask your own questions.",
33
- examples=[
34
- ["Tell me about machine learning"],
35
- ["What is Python programming language?"],
36
- ["Web development best practices"],
37
- ["What is artificial intelligence?"]
38
- ],
39
  )
40
 
41
  # Launch the Gradio interface
 
2
 
3
  class TafGPT:
4
  def generate_response(self, user_input):
5
+ # Replace this with your own logic or use external APIs for more advanced responses
6
+ response = f"Taf-gpt: Thank you for your input: '{user_input}'. I'm a simple chatbot for now."
 
 
 
 
 
 
 
7
 
8
+ return response
 
 
 
 
 
9
 
10
  # Create an instance of TafGPT
11
  taf_gpt = TafGPT()
 
13
  # Define Gradio interface
14
  iface = gr.Interface(
15
  fn=taf_gpt.generate_response,
16
+ inputs="text",
17
+ outputs="text",
18
  live=True,
19
+ title="Taf-gpt Chatbot",
20
+ description="Welcome to Taf-gpt! Enter your message below.",
 
 
 
 
 
 
21
  )
22
 
23
  # Launch the Gradio interface