aliabid94 HF staff commited on
Commit
ee884ce
1 Parent(s): b4a9d32

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +5 -17
  2. requirements.txt +0 -2
  3. run.py +11 -10
  4. test/a +0 -0
README.md CHANGED
@@ -1,20 +1,8 @@
1
  ---
2
- title: GPT Golf
3
- emoji: ⛳
4
- colorFrom: blue
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 3.1.5
8
  app_file: run.py
9
- pinned: false
10
- license: gpl-3.0
11
- ---
12
-
13
- # GPT Golf
14
 
15
- How many turns will it take you to get GPT to say the target word?
16
- Here are the rules of the game:
17
- - Your goal is to get GPT to say a target word in as few turns as possible.
18
- - Each turn, you add up to 5 words to its dialogue.
19
- - When you click submit, your prompt will be added to the dialogue. Then GPT will also add to the dialogue.
20
- - You can't say the target word, but as soon as GPT does, you win!
1
  ---
2
+ title: GPT-Golf
 
 
 
 
 
3
  app_file: run.py
4
+ emoji: 🤗
5
+ colorFrom: pink
6
+ colorTo: pink
 
 
7
 
8
+ ---
 
 
 
 
 
requirements.txt CHANGED
@@ -1,2 +0,0 @@
1
- torch
2
- transformers
 
 
run.py CHANGED
@@ -1,28 +1,29 @@
1
  import gradio as gr
2
  import json
3
  import random
4
- from transformers import pipeline
5
 
6
- generator = pipeline("text-generation", model="gpt2", max_length=60)
7
 
8
  with open("wordlist.json") as wordlist_json:
9
  wordlist = json.load(wordlist_json)
10
 
11
 
12
  def autocomplete(text):
13
- end_text = " ".join(text.split(" ")[-30:])
14
- generated_text = generator(
15
- end_text, return_full_text=False, clean_up_tokenization_spaces=True
16
- )[0]["generated_text"]
17
- generated_text = generated_text.replace("\n", ". ")
18
- generated_text = " ".join(generated_text.split(" ")[:-1])
19
- return generated_text
20
 
21
 
22
  with gr.Blocks() as demo:
23
  gr.Markdown(
24
  """
25
  # GPT Golf
 
26
  How many turns will it take you to get GPT to say the target word?
27
  Here are the rules of the game:
28
  - Your goal is to get GPT to say a target word in as few turns as possible.
@@ -111,4 +112,4 @@ with gr.Blocks() as demo:
111
  )
112
 
113
 
114
- demo.launch(debug=True)
1
  import gradio as gr
2
  import json
3
  import random
4
+ # from transformers import pipeline
5
 
6
+ # generator = pipeline("text-generation", model="gpt2", max_length=60)
7
 
8
  with open("wordlist.json") as wordlist_json:
9
  wordlist = json.load(wordlist_json)
10
 
11
 
12
  def autocomplete(text):
13
+ return "more words"
14
+ # end_text = " ".join(text.split(" ")[-30:-1])
15
+ # generated_text = generator(
16
+ # end_text, return_full_text=False, clean_up_tokenization_spaces=True
17
+ # )[0]["generated_text"]
18
+ # generated_text = generated_text.replace("\n", "")
19
+ # return generated_text
20
 
21
 
22
  with gr.Blocks() as demo:
23
  gr.Markdown(
24
  """
25
  # GPT Golf
26
+
27
  How many turns will it take you to get GPT to say the target word?
28
  Here are the rules of the game:
29
  - Your goal is to get GPT to say a target word in as few turns as possible.
112
  )
113
 
114
 
115
+ demo.launch()
test/a ADDED
File without changes