richardkimsm89 commited on
Commit
da3d905
·
verified ·
1 Parent(s): 9df2760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -34
app.py CHANGED
@@ -15,7 +15,7 @@ app = gr.load(
15
  ]
16
  ).launch()
17
  """
18
- """
19
  # Pipeline
20
 
21
  import gradio as gr
@@ -39,36 +39,4 @@ app = gr.Interface(
39
  examples = [
40
  ["Hello, World."]
41
  ]
42
- ).launch()
43
- """
44
-
45
- import gradio as gr
46
- from huggingface_hub import InferenceClient
47
- import os
48
-
49
- hf_token = os.getenv("HF_TOKEN")
50
-
51
- def chat(messages):
52
- client = InferenceClient(api_key=hf_token)
53
- stream = client.chat.completions.create(
54
- model="google/gemma-2-2b-it",
55
- messages=messages,
56
- #temperature=0.5,
57
- #max_tokens=2048,
58
- #top_p=0.7,
59
- stream=True
60
- )
61
- story = ""
62
- for chunk in stream:
63
- story += chunk.choices[0].delta.content
64
- return story
65
-
66
- interface = gr.Interface(
67
- fn=chat,
68
- inputs="textbox",
69
- outputs="textbox",
70
- title="Storyteller with Gemma",
71
- description="Tell me a story starter and I'll continue it using Gemma!"
72
- )
73
-
74
- interface.launch()
 
15
  ]
16
  ).launch()
17
  """
18
+
19
  # Pipeline
20
 
21
  import gradio as gr
 
39
  examples = [
40
  ["Hello, World."]
41
  ]
42
+ ).launch()