-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_openai.py
More file actions
18 lines (15 loc) · 834 Bytes
/
02_openai.py
File metadata and controls
18 lines (15 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import pipeline
# Load model
generator = pipeline("text-generation", model="tiiuae/falcon-7b-instruct", device_map="auto")
command = '''
[10:19 PM, 7/24/2025] ʐɛɛֆɦǟռ: OK
[9:14 PM, 7/27/2025] ʐɛɛֆɦǟռ: AoA bhai me ready hony lga hu
[10:52 PM, 7/27/2025] ʐɛɛֆɦǟռ: I am ready
[9:19 PM, 7/28/2025] ʐɛɛֆɦǟռ: Me 10 min tk ready hony lga hoo
[9:20 PM, 7/28/2025] Mubashir Ali: Okay
[9:20 PM, 7/28/2025] Mubashir Ali: Ho jao ready
[9:20 PM, 7/28/2025] Mubashir Ali: Balka ready ho k nikal ao
'''
prompt = f"You are Zeeshan from Pakistan, a coder who speaks Hindi/English. Respond like a casual friend:\n\n{command}\n\nResponse:"
response = generator(prompt, max_length=150, do_sample=True, temperature=0.7)[0]['generated_text']
print(response.split("Response:")[-1].strip())