Spaces:
Sleeping
Sleeping
Commit
·
51ea30b
1
Parent(s):
1c9b431
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,11 @@ def inference(img, ver):
|
|
| 12 |
return out
|
| 13 |
|
| 14 |
def generate(text,guess):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
inputs = tokenizer(f"Answer with yes or no the following question about {guess}: {text}?", return_tensors="pt")
|
| 16 |
return model.generate(**inputs)[0]
|
| 17 |
|
|
@@ -23,7 +28,7 @@ examples = [
|
|
| 23 |
demo = gr.Interface(
|
| 24 |
fn=generate,
|
| 25 |
inputs=[gr.inputs.Textbox(lines=5, label="Input Text"),
|
| 26 |
-
gr.inputs.Radio("Hidden Identity 1", type="
|
| 27 |
outputs=gr.outputs.Textbox(label="Generated Text"),
|
| 28 |
examples=examples
|
| 29 |
)
|
|
|
|
| 12 |
return out
|
| 13 |
|
| 14 |
def generate(text,guess):
|
| 15 |
+
if ver == "Hidden Identity 1":
|
| 16 |
+
guess = "Michael Jackson"
|
| 17 |
+
else:
|
| 18 |
+
guess = "Brad Pitt"
|
| 19 |
+
|
| 20 |
inputs = tokenizer(f"Answer with yes or no the following question about {guess}: {text}?", return_tensors="pt")
|
| 21 |
return model.generate(**inputs)[0]
|
| 22 |
|
|
|
|
| 28 |
demo = gr.Interface(
|
| 29 |
fn=generate,
|
| 30 |
inputs=[gr.inputs.Textbox(lines=5, label="Input Text"),
|
| 31 |
+
gr.inputs.Radio("Hidden Identity 1", type="text", default='Hidden Identity 1', label='Hidden identity')],
|
| 32 |
outputs=gr.outputs.Textbox(label="Generated Text"),
|
| 33 |
examples=examples
|
| 34 |
)
|