genaibeauty commited on
Commit
91d5952
·
verified ·
1 Parent(s): 3351f1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -12,8 +12,8 @@ WHISPER_API_URL = "https://api-inference.huggingface.co/models/openai/whisper-la
12
  # Set up headers for the Whisper API request
13
  headers = {"Authorization": f"Bearer {api_key}"}
14
 
15
- # Load the DeepSeek model using Hugging Face's pipeline
16
- pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
17
 
18
  # Function to query the Hugging Face Whisper model for audio transcription
19
  def transcribe_audio(audio_file):
@@ -25,7 +25,7 @@ def transcribe_audio(audio_file):
25
  else:
26
  return f"Error: {response.status_code}, {response.text}"
27
 
28
- # Function to generate Mermaid.js code using the DeepSeek model (replaces Mistral API call)
29
  def generate_mermaid_code(prompt):
30
  # Instruction included in the prompt to guide DeepSeek to generate valid MermaidJS code
31
  deepseek_prompt = f"Generate a valid MermaidJS diagram code for the following: {prompt}"
@@ -39,11 +39,11 @@ def process_input(input_type, text_input, audio_input):
39
  if input_type == "Audio" and audio_input is not None:
40
  # Transcribe audio using the Whisper API
41
  transcription = transcribe_audio(audio_input)
42
- # Generate Mermaid.js code from transcription using DeepSeek-R1
43
  return generate_mermaid_code(transcription)
44
 
45
  elif input_type == "Text" and text_input:
46
- # Generate Mermaid.js code directly from text input using DeepSeek-R1
47
  return generate_mermaid_code(text_input)
48
 
49
  elif input_type == "Text and Audio" and text_input and audio_input is not None:
@@ -51,7 +51,7 @@ def process_input(input_type, text_input, audio_input):
51
  transcription = transcribe_audio(audio_input)
52
  # Combine text input and transcription
53
  combined_input = f"{text_input} and {transcription}"
54
- # Generate Mermaid.js code using DeepSeek-R1
55
  return generate_mermaid_code(combined_input)
56
 
57
  else:
 
12
  # Set up headers for the Whisper API request
13
  headers = {"Authorization": f"Bearer {api_key}"}
14
 
15
+ # Load the DeepSeek-R1-Distill-Qwen-1.5B model using Hugging Face's pipeline
16
+ pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B")
17
 
18
  # Function to query the Hugging Face Whisper model for audio transcription
19
  def transcribe_audio(audio_file):
 
25
  else:
26
  return f"Error: {response.status_code}, {response.text}"
27
 
28
+ # Function to generate Mermaid.js code using the DeepSeek model (DeepSeek-R1-Distill-Qwen-1.5B)
29
  def generate_mermaid_code(prompt):
30
  # Instruction included in the prompt to guide DeepSeek to generate valid MermaidJS code
31
  deepseek_prompt = f"Generate a valid MermaidJS diagram code for the following: {prompt}"
 
39
  if input_type == "Audio" and audio_input is not None:
40
  # Transcribe audio using the Whisper API
41
  transcription = transcribe_audio(audio_input)
42
+ # Generate Mermaid.js code from transcription using DeepSeek-R1-Distill-Qwen-1.5B
43
  return generate_mermaid_code(transcription)
44
 
45
  elif input_type == "Text" and text_input:
46
+ # Generate Mermaid.js code directly from text input using DeepSeek-R1-Distill-Qwen-1.5B
47
  return generate_mermaid_code(text_input)
48
 
49
  elif input_type == "Text and Audio" and text_input and audio_input is not None:
 
51
  transcription = transcribe_audio(audio_input)
52
  # Combine text input and transcription
53
  combined_input = f"{text_input} and {transcription}"
54
+ # Generate Mermaid.js code using DeepSeek-R1-Distill-Qwen-1.5B
55
  return generate_mermaid_code(combined_input)
56
 
57
  else: