lingadevaruhp commited on
Commit
2956b29
·
verified ·
1 Parent(s): 9120c3c

Update app.py - rename interface from Flirt-AI and Phi-3-Mini to thoshan_Flash

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -4,8 +4,8 @@ import gradio as gr
4
  import json
5
  import os
6
 
7
- # Load tokenizer and model - using Phi-3-mini which is publicly accessible
8
- model_name = "microsoft/Phi-3-mini-4k-instruct"
9
  tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
10
 
11
  # Load base model directly (no LoRA adapters)
@@ -48,8 +48,8 @@ def generate_response(prompt, max_new_tokens=100):
48
  elif 'text' in entry:
49
  context_text += f"{entry['text']}\n\n"
50
  context = f"Dataset context:\n{context_text}\n" if context_text else ""
51
-
52
- # Format the prompt for Phi-3
53
  formatted_prompt = f"<|user|>\n{context}{prompt}<|end|>\n<|assistant|>\n"
54
 
55
  inputs = tokenizer(formatted_prompt, return_tensors="pt")
@@ -63,7 +63,7 @@ def generate_response(prompt, max_new_tokens=100):
63
  top_p=0.9,
64
  pad_token_id=tokenizer.eos_token_id
65
  )
66
-
67
  # Decode only the generated part (excluding the input)
68
  generated_text = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
69
  return generated_text.strip()
@@ -76,8 +76,8 @@ iface = gr.Interface(
76
  gr.Slider(minimum=10, maximum=200, value=100, label="Max New Tokens")
77
  ],
78
  outputs=gr.Textbox(label="AI Response"),
79
- title="Flirt-AI with Phi-3-Mini (Updated with JSONL Dataset)",
80
- description="Chat with AI powered by the new flirt_dataset.jsonl dataset!"
81
  )
82
 
83
  if __name__ == "__main__":
 
4
  import json
5
  import os
6
 
7
+ # Load tokenizer and model - using thoshan_Flash model
8
+ model_name = "microsoft/Phi-3-mini-4k-instruct" # Will be replaced with actual thoshan_Flash model when available
9
  tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
10
 
11
  # Load base model directly (no LoRA adapters)
 
48
  elif 'text' in entry:
49
  context_text += f"{entry['text']}\n\n"
50
  context = f"Dataset context:\n{context_text}\n" if context_text else ""
51
+
52
+ # Format the prompt for thoshan_Flash
53
  formatted_prompt = f"<|user|>\n{context}{prompt}<|end|>\n<|assistant|>\n"
54
 
55
  inputs = tokenizer(formatted_prompt, return_tensors="pt")
 
63
  top_p=0.9,
64
  pad_token_id=tokenizer.eos_token_id
65
  )
66
+
67
  # Decode only the generated part (excluding the input)
68
  generated_text = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
69
  return generated_text.strip()
 
76
  gr.Slider(minimum=10, maximum=200, value=100, label="Max New Tokens")
77
  ],
78
  outputs=gr.Textbox(label="AI Response"),
79
+ title="thoshan_Flash (Updated with JSONL Dataset)",
80
+ description="Chat with AI powered by thoshan_Flash and the new flirt_dataset.jsonl dataset!"
81
  )
82
 
83
  if __name__ == "__main__":