Spaces:
Running
Running
Commit
ยท
e8893c1
1
Parent(s):
bf91d2a
๐ต๏ธ Add plots
Browse files- .gitattributes +1 -0
- Data/human-writing-dpo.json +3 -0
- 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():
|