KingNish commited on
Commit
822036b
β€’
1 Parent(s): 68bde08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -27
app.py CHANGED
@@ -4,7 +4,7 @@ from huggingface_hub import InferenceClient
4
 
5
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
6
 
7
- system_instructions = """<s> [INST] You will be provided with text, and your task is to classify task tasks are (text generation, image generation, pdf chat, image text to text, image classification, summarization, translation , tts) """
8
 
9
 
10
  def classify_task(prompt):
@@ -24,35 +24,11 @@ def classify_task(prompt):
24
 
25
  for response in stream:
26
  output += response.token.text
27
-
28
- # Define the classification function
29
- def classify_task2(prompt):
30
- # Here you would implement the logic to classify the prompt
31
- # For example, using if-elif-else statements or a machine learning model
32
- if 'generate text' in prompt.lower():
33
- return 'Text Generation'
34
- elif 'generate image' in prompt.lower():
35
- return 'Image Generation'
36
- elif 'pdf chat' in prompt.lower():
37
- return 'PDF Chat'
38
- elif 'image to text' in prompt.lower():
39
- return 'Image Text to Text'
40
- elif 'classify image' in prompt.lower():
41
- return 'Image Classification'
42
- else:
43
- return 'Unknown Task'
44
 
45
  # Create the Gradio interface
46
  with gr.Blocks() as demo:
47
- gr.HTML("""
48
- <center><h1>Emoji Translator πŸ€—πŸ˜»</h1>
49
- <h3>Translate any text into emojis, and vice versa!</h3>
50
- </center>
51
- """)
52
-
53
- gr.Markdown("""
54
- # Text to Emoji πŸ“–βž‘οΈπŸ˜»
55
- """)
56
  with gr.Row():
57
  text_uesr_input = gr.Textbox(label="Enter text πŸ“š")
58
  output = gr.Textbox(label="Translation")
 
4
 
5
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
6
 
7
+ system_instructions = "You will be provided with text, and your task is to classify task tasks are (text generation, image generation, pdf chat, image text to text, image classification, summarization, translation , tts) answer with only task do not say anything else and stop as soon as possible."
8
 
9
 
10
  def classify_task(prompt):
 
24
 
25
  for response in stream:
26
  output += response.token.text
27
+ yield output
28
+ return output
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  # Create the Gradio interface
31
  with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
32
  with gr.Row():
33
  text_uesr_input = gr.Textbox(label="Enter text πŸ“š")
34
  output = gr.Textbox(label="Translation")