KingNish commited on
Commit
c9ca579
β€’
1 Parent(s): 93a93a5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Define the classification function
4
+ def classify_task(prompt):
5
+ # Here you would implement the logic to classify the prompt
6
+ # For example, using if-elif-else statements or a machine learning model
7
+ if 'generate text' in prompt.lower():
8
+ return 'Text Generation'
9
+ elif 'generate image' in prompt.lower():
10
+ return 'Image Generation'
11
+ elif 'pdf chat' in prompt.lower():
12
+ return 'PDF Chat'
13
+ elif 'image to text' in prompt.lower():
14
+ return 'Image Text to Text'
15
+ elif 'classify image' in prompt.lower():
16
+ return 'Image Classification'
17
+ else:
18
+ return 'Unknown Task'
19
+
20
+ # Create the Gradio interface
21
+ iface = gr.Interface(
22
+ fn=classify_task,
23
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your prompt here..."),
24
+ outputs='text',
25
+ title='AI Task Classifier Chatbot',
26
+ description='This chatbot classifies your prompt into different AI tasks.'
27
+ )
28
+
29
+ # Launch the app
30
+ if __name__ == "__main__":
31
+ iface.launch()