Spaces:
Sleeping
Sleeping
updates
Browse files- main.py +2 -2
- static/index.html +1 -1
- static/script.js +4 -2
main.py
CHANGED
@@ -51,7 +51,7 @@ def generate_image(prompt, inference_steps, model):
|
|
51 |
|
52 |
image.save(filename)
|
53 |
|
54 |
-
print(filename
|
55 |
#print(f"after save")
|
56 |
|
57 |
|
@@ -75,7 +75,7 @@ def generate_image(prompt, inference_steps, model):
|
|
75 |
|
76 |
subprocess.check_output(['./truepic-sign', 'sign', filename, '--profile', 'demo', '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/' + filename)])
|
77 |
|
78 |
-
return {"response":
|
79 |
|
80 |
|
81 |
@app.get("/generate-picsum")
|
|
|
51 |
|
52 |
image.save(filename)
|
53 |
|
54 |
+
print(filename)
|
55 |
#print(f"after save")
|
56 |
|
57 |
|
|
|
75 |
|
76 |
subprocess.check_output(['./truepic-sign', 'sign', filename, '--profile', 'demo', '--assertions', 'assertion.json', '--output', (os.getcwd() + '/static/' + filename)])
|
77 |
|
78 |
+
return {"response": filename}
|
79 |
|
80 |
|
81 |
@app.get("/generate-picsum")
|
static/index.html
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<main>
|
13 |
<section id="text-gen">
|
14 |
<h1>Text to Image with Signed Attribution</h1>
|
15 |
-
<truepic-display><img src="/output.jpg" /></truepic-display>
|
16 |
<form class="text-gen-form" style="padding:40px 0;">
|
17 |
<label for="text-gen-input">Enter prompt: </label>
|
18 |
<input
|
|
|
12 |
<main>
|
13 |
<section id="text-gen">
|
14 |
<h1>Text to Image with Signed Attribution</h1>
|
15 |
+
<truepic-display><img src="/output.jpg" id="output" /></truepic-display>
|
16 |
<form class="text-gen-form" style="padding:40px 0;">
|
17 |
<label for="text-gen-input">Enter prompt: </label>
|
18 |
<input
|
static/script.js
CHANGED
@@ -27,7 +27,7 @@ const generateImage = async (text, inference_steps, model) => {
|
|
27 |
const inferResponse = await fetch(`generate?prompt=${text}&inference_steps=${inference_steps}&model=${model}`);
|
28 |
const inferJson = await inferResponse.json();
|
29 |
|
30 |
-
return inferJson.
|
31 |
};
|
32 |
|
33 |
|
@@ -40,7 +40,9 @@ textGenForm.addEventListener('submit', async (event) => {
|
|
40 |
|
41 |
try {
|
42 |
const resp = await generateImage(textGenInput.value, inferenceSteps.value, model.value);
|
43 |
-
|
|
|
|
|
44 |
} catch (err) {
|
45 |
console.error(err);
|
46 |
}
|
|
|
27 |
const inferResponse = await fetch(`generate?prompt=${text}&inference_steps=${inference_steps}&model=${model}`);
|
28 |
const inferJson = await inferResponse.json();
|
29 |
|
30 |
+
return inferJson.response;
|
31 |
};
|
32 |
|
33 |
|
|
|
40 |
|
41 |
try {
|
42 |
const resp = await generateImage(textGenInput.value, inferenceSteps.value, model.value);
|
43 |
+
alert(resp);
|
44 |
+
document.getElementById("ouptput").src = resp;
|
45 |
+
// document.getElementById("redirect-form").submit();
|
46 |
} catch (err) {
|
47 |
console.error(err);
|
48 |
}
|