mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-24 09:04:19 +01:00
refactor: add example hide logs only text blob and uri
This commit is contained in:
17
README.md
17
README.md
@@ -183,6 +183,13 @@ gptdeploy create --description "Generate QR code from URL" --test "https://www.e
|
||||
```
|
||||
<img src="res/qr_example.png" alt="QR Code Generator" width="600" />
|
||||
|
||||
### Mandelbrot Set Visualizer
|
||||
|
||||
```bash
|
||||
gptdeploy create --description "Visualize the Mandelbrot set with custom parameters" --test "center=-0+1i, zoom=1.0, size=800x800, iterations=1000"
|
||||
```
|
||||
<img src="res/mandelbrot_example.png" alt="Mandelbrot Set Visualizer" width="600" />
|
||||
|
||||
|
||||
[//]: # (## TO BE TESTED)
|
||||
|
||||
@@ -344,13 +351,6 @@ gptdeploy create --description "Generate QR code from URL" --test "https://www.e
|
||||
[//]: # ()
|
||||
|
||||
[//]: # ()
|
||||
[//]: # (### Mandelbrot Set Visualizer)
|
||||
|
||||
[//]: # (```bash)
|
||||
|
||||
[//]: # (gptdeploy create --description "Visualize the Mandelbrot set with custom parameters" --test "center=-0.5+0i, zoom=1.0, size=800x800, iterations=1000")
|
||||
|
||||
[//]: # (```)
|
||||
|
||||
[//]: # (### Sound Visualizer)
|
||||
|
||||
@@ -440,3 +440,6 @@ Make sure it is only printed twice in case it changed.
|
||||
- [ ] section for microservices built by the community
|
||||
- [ ] test feedback for playground generation (could be part of the debugging)
|
||||
- [ ] should we send everything via json in the text attribute for simplicity?
|
||||
|
||||
Proposal:
|
||||
- [ ] just generate the non-jina related code and insert it into an executor template
|
||||
|
||||
BIN
res/mandelbrot_example.png
Normal file
BIN
res/mandelbrot_example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 236 KiB |
@@ -10,6 +10,8 @@ import hubble
|
||||
from hubble.executor.helper import upload_file, archive_package, get_request_header
|
||||
from jcloud.flow import CloudFlow
|
||||
|
||||
from src.utils.io import suppress_stdout
|
||||
|
||||
|
||||
def redirect_callback(href):
|
||||
print(
|
||||
@@ -41,7 +43,9 @@ def push_executor(dir_path):
|
||||
'verbose': 'True',
|
||||
'md5sum': md5_digest,
|
||||
}
|
||||
req_header = get_request_header()
|
||||
with suppress_stdout():
|
||||
req_header = get_request_header()
|
||||
|
||||
resp = upload_file(
|
||||
'https://api.hubble.jina.ai/v2/rpc/executor.push',
|
||||
'filename',
|
||||
|
||||
@@ -66,7 +66,7 @@ d1 = Document(text='hello')
|
||||
url = 'https://...'
|
||||
response = requests.get(url)
|
||||
obj_data = response.content
|
||||
d2 = Document(blob=obj_data) # blob is bytes like b'\\x89PNG\\r\\n\\x1a\\n\
|
||||
d2 = Document(blob=obj_data) # blob is bytes like b'\\x89PNG\\r\\n\\x1a\\n...'
|
||||
|
||||
d3 = Document(tensor=numpy.array([1, 2, 3]), chunks=[Document(uri=/local/path/to/file)]
|
||||
d4 = Document(
|
||||
|
||||
@@ -135,4 +135,5 @@ The executor must not load data from the local file system unless it was created
|
||||
The executor must not use a pre-trained model unless it is explicitly mentioned in the description.
|
||||
The executor must not train a model.
|
||||
The executor must not use Document.tags.
|
||||
The executor must only use Document.uri, Document.blob and Document.text.
|
||||
'''
|
||||
@@ -3,6 +3,8 @@ import shutil
|
||||
import concurrent.futures
|
||||
import concurrent.futures
|
||||
from typing import Generator
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
|
||||
def recreate_folder(folder_path):
|
||||
if os.path.exists(folder_path) and os.path.isdir(folder_path):
|
||||
@@ -34,4 +36,14 @@ def timeout_generator_wrapper(generator, timeout):
|
||||
except concurrent.futures.TimeoutError:
|
||||
raise GenerationTimeoutError(f"Generation took longer than {timeout} seconds")
|
||||
|
||||
return wrapper()
|
||||
return wrapper()
|
||||
|
||||
@contextmanager
|
||||
def suppress_stdout():
|
||||
original_stdout = sys.stdout
|
||||
sys.stdout = open(os.devnull, 'w')
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
sys.stdout.close()
|
||||
sys.stdout = original_stdout
|
||||
Reference in New Issue
Block a user