BICORP commited on
Commit
166c1ae
1 Parent(s): 42cb731

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -14,24 +14,24 @@ pixtral_client = InferenceClient("mistralai/Pixtral-12B-2409")
14
 
15
  def enhance_prompt(prompt: str) -> str:
16
  # Use the Paligemma models for prompt enhancement
17
- prompt_224 = paligemma224_client.predict(inputs={"inputs": prompt})["generated_text"]
18
- prompt_448 = paligemma448_client.predict(inputs={"inputs": prompt})["generated_text"]
19
- prompt_896 = paligemma896_client.predict(inputs={"inputs": prompt})["generated_text"]
20
 
21
  # Combine all enhanced prompts into a single one
22
  enhanced_prompt = f"Enhanced (224): {prompt_224}\nEnhanced (448): {prompt_448}\nEnhanced (896): {prompt_896}"
23
 
24
  # Ultra-enhance the prompt using Paligemma 28b
25
- ultra_enhanced_prompt = paligemma28b_client.predict(inputs={"inputs": enhanced_prompt})["generated_text"]
26
 
27
  return ultra_enhanced_prompt
28
 
29
 
30
  def generate_answer(enhanced_prompt: str) -> str:
31
  # Generate answers using the three models: llama, deepseek, and omniparser
32
- llama_answer = llama_client.predict(inputs={"inputs": enhanced_prompt})["generated_text"]
33
- deepseek_answer = deepseek_client.predict(inputs={"inputs": enhanced_prompt})["generated_text"]
34
- omniparser_answer = omniparser_client.predict(inputs={"inputs": enhanced_prompt})["generated_text"]
35
 
36
  # Combine answers from all models
37
  combined_answer = f"Llama: {llama_answer}\nDeepseek: {deepseek_answer}\nOmniparser: {omniparser_answer}"
@@ -41,7 +41,7 @@ def generate_answer(enhanced_prompt: str) -> str:
41
 
42
  def enhance_answer(answer: str) -> str:
43
  # Enhance the final answer using Pixtral model
44
- enhanced_answer = pixtral_client.predict(inputs={"inputs": answer})["generated_text"]
45
  return enhanced_answer
46
 
47
 
 
14
 
15
  def enhance_prompt(prompt: str) -> str:
16
  # Use the Paligemma models for prompt enhancement
17
+ prompt_224 = paligemma224_client(inputs={"inputs": prompt})["generated_text"]
18
+ prompt_448 = paligemma448_client(inputs={"inputs": prompt})["generated_text"]
19
+ prompt_896 = paligemma896_client(inputs={"inputs": prompt})["generated_text"]
20
 
21
  # Combine all enhanced prompts into a single one
22
  enhanced_prompt = f"Enhanced (224): {prompt_224}\nEnhanced (448): {prompt_448}\nEnhanced (896): {prompt_896}"
23
 
24
  # Ultra-enhance the prompt using Paligemma 28b
25
+ ultra_enhanced_prompt = paligemma28b_client(inputs={"inputs": enhanced_prompt})["generated_text"]
26
 
27
  return ultra_enhanced_prompt
28
 
29
 
30
  def generate_answer(enhanced_prompt: str) -> str:
31
  # Generate answers using the three models: llama, deepseek, and omniparser
32
+ llama_answer = llama_client(inputs={"inputs": enhanced_prompt})["generated_text"]
33
+ deepseek_answer = deepseek_client(inputs={"inputs": enhanced_prompt})["generated_text"]
34
+ omniparser_answer = omniparser_client(inputs={"inputs": enhanced_prompt})["generated_text"]
35
 
36
  # Combine answers from all models
37
  combined_answer = f"Llama: {llama_answer}\nDeepseek: {deepseek_answer}\nOmniparser: {omniparser_answer}"
 
41
 
42
  def enhance_answer(answer: str) -> str:
43
  # Enhance the final answer using Pixtral model
44
+ enhanced_answer = pixtral_client(inputs={"inputs": answer})["generated_text"]
45
  return enhanced_answer
46
 
47