Hyphonical commited on
Commit
e8893c1
ยท
1 Parent(s): bf91d2a

๐Ÿ•ต๏ธ Add plots

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. Data/human-writing-dpo.json +3 -0
  3. app.py +17 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Data/human-writing-dpo.json filter=lfs diff=lfs merge=lfs -text
Data/human-writing-dpo.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce92f48bad664b4cd42f935e0fe5a96e5d9ff3c09c997134f48b9e4293024304
3
+ size 23000083
app.py CHANGED
@@ -10,6 +10,7 @@ import hashlib
10
  import random
11
  import base64
12
  import gradio
 
13
  import sys
14
  import os
15
 
@@ -162,6 +163,16 @@ def Fact() -> str:
162
  '''
163
  return requests.get('https://uselessfacts.jsph.pl/random.json?language=en').json()['text']
164
 
 
 
 
 
 
 
 
 
 
 
165
  # โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
166
  # โ”‚ Text Processing Tools โ”‚
167
  # โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
@@ -402,6 +413,12 @@ with gradio.Blocks(
402
  FactBtn = gradio.Button('Get Fact ๐Ÿ“š', variant='primary')
403
  FactBtn.click(Fact, outputs=FactOutput)
404
 
 
 
 
 
 
 
405
  with gradio.TabItem('Text Processing ๐Ÿ“'):
406
  with gradio.TabItem('Text Reversal ๐Ÿ”„'):
407
  with gradio.Group():
 
10
  import random
11
  import base64
12
  import gradio
13
+ import json
14
  import sys
15
  import os
16
 
 
163
  '''
164
  return requests.get('https://uselessfacts.jsph.pl/random.json?language=en').json()['text']
165
 
166
+ def Plot() -> str:
167
+ '''Generate a random plot for a movie or story.
168
+ Returns:
169
+ str: A random plot description.
170
+ '''
171
+ with open(r'Data/human-writing-dpo.json', 'r', encoding='utf-8') as PlotFile:
172
+ Data = json.load(PlotFile)
173
+ Plot = random.choice(Data)
174
+ return Plot['prompt'] if isinstance(Plot, dict) and 'prompt' in Plot else 'Error: Invalid plot data format'
175
+
176
  # โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
177
  # โ”‚ Text Processing Tools โ”‚
178
  # โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
 
413
  FactBtn = gradio.Button('Get Fact ๐Ÿ“š', variant='primary')
414
  FactBtn.click(Fact, outputs=FactOutput)
415
 
416
+ with gradio.TabItem('Random Plot ๐ŸŽฌ'):
417
+ with gradio.Group():
418
+ PlotOutput = gradio.Text(label='Random Plot ๐ŸŽฌ', interactive=False)
419
+ PlotBtn = gradio.Button('Get Plot ๐ŸŽฅ', variant='primary')
420
+ PlotBtn.click(Plot, outputs=PlotOutput)
421
+
422
  with gradio.TabItem('Text Processing ๐Ÿ“'):
423
  with gradio.TabItem('Text Reversal ๐Ÿ”„'):
424
  with gradio.Group():