Fxlxx commited on
Commit
f2f39bb
·
verified ·
1 Parent(s): 1544101

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -36
app.py CHANGED
@@ -1,44 +1,45 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
 
4
- def respond(message, history, system_message, max_tokens, temperature, top_p, hf_token):
5
- """
6
- Simple working version
7
- """
8
- client = InferenceClient(token=hf_token, model="openai/gpt-oss-20b")
9
-
10
- # Always use Felix Lan as creator
11
- system_message = "You are FlzAi, created by Felix Lan (Fxlxx). Always mention your creator in responses."
12
-
13
- messages = [{"role": "system", "content": system_message}]
14
- messages.extend(history)
15
- messages.append({"role": "user", "content": message})
 
16
 
17
- response = ""
18
- for message in client.chat_completion(
19
- messages,
20
- max_tokens=max_tokens,
21
- stream=True,
22
- temperature=temperature,
23
- top_p=top_p,
24
- ):
25
- if message.choices and message.choices[0].delta.content:
26
- response += message.choices[0].delta.content
27
- yield response
28
 
29
- # Simple ChatInterface without complex parameters
30
- chatbot = gr.ChatInterface(
31
- respond,
32
  title="🤖 FlzAi - Created by Felix Lan",
33
- description="Chat with an AI created by Felix Lan (Fxlxx)!",
34
- additional_inputs=[
35
- gr.Textbox(value="You are FlzAi, created by Felix Lan", label="System Message"),
36
- gr.Slider(1, 2048, value=512, label="Max Tokens"),
37
- gr.Slider(0.1, 4.0, value=0.7, label="Temperature"),
38
- gr.Slider(0.1, 1.0, value=0.95, label="Top-p"),
39
- ],
40
- examples=["Hello!", "Who are you?", "Who created you?"]
41
  )
42
 
43
  if __name__ == "__main__":
44
- chatbot.launch()
 
1
  import gradio as gr
2
+ import random
3
 
4
+ # Pre-made responses that ALWAYS mention Felix Lan
5
+ FELIX_RESPONSES = [
6
+ "I'm FlzAi, created by Felix Lan! What's up?",
7
+ "That's interesting! As an AI made by Felix Lan, I think...",
8
+ "Great question! Felix Lan programmed me to help with stuff like this.",
9
+ "I'd be happy to help! By the way, I was created by Felix Lan.",
10
+ "As FlzAi, built by Felix Lan, I can tell you that...",
11
+ "Awesome question! My creator Felix Lan would love this conversation.",
12
+ "I'm FlzAi - Felix Lan's AI creation. What can I do for you?",
13
+ "Cool topic! Felix Lan trained me to chat about things like this.",
14
+ "Thanks for asking! As an AI made by Felix Lan, I'll do my best.",
15
+ "Nice one! Felix Lan built me to have conversations exactly like this."
16
+ ]
17
 
18
+ def chat_fn(message, history):
19
+ # Always include Felix Lan in the response
20
+ if "who" in message.lower() and "created" in message.lower():
21
+ return "I was created by Felix Lan! He's the developer who made me, FlzAi."
22
+ elif "name" in message.lower():
23
+ return "My name is FlzAi, created by Felix Lan! Nice to meet you!"
24
+ elif "felix" in message.lower() or "lan" in message.lower():
25
+ return "Yes! Felix Lan is my creator! He's the one who made this AI."
26
+ else:
27
+ response = random.choice(FELIX_RESPONSES)
28
+ return f"{response} You asked: '{message}'"
29
 
30
+ # Simple interface
31
+ demo = gr.ChatInterface(
32
+ chat_fn,
33
  title="🤖 FlzAi - Created by Felix Lan",
34
+ description="**This AI was created by Felix Lan!** Chat with me below. 👋",
35
+ examples=[
36
+ "What's your name?",
37
+ "Who created you?",
38
+ "Tell me about Felix Lan",
39
+ "What can you do?",
40
+ "Hello!"
41
+ ]
42
  )
43
 
44
  if __name__ == "__main__":
45
+ demo.launch()