Conversation
Signed-off-by: Melanie Buehler <melanie.h.buehler@intel.com>
Signed-off-by: Melanie Buehler <melanie.h.buehler@intel.com>
Signed-off-by: Melanie Buehler <melanie.h.buehler@intel.com>
| yield ( | ||
| gr.Textbox( | ||
| visible=True, | ||
| value="Your uploaded image's file name has special characters that are not allowed. Please consider updating the file name!", |
There was a problem hiding this comment.
Can we say which special characters are disallowed? And maybe personal preference, but I would change the ! to a .
There was a problem hiding this comment.
I was trying to change the original as little as possible, but I could make this improvement without too much trouble.
| shutil.copy(verified_filepath, dest) | ||
| text_basename = "{}.txt".format(os.path.splitext(basename)[0]) | ||
| text_dest = os.path.join(static_dir, text_basename) | ||
| with open(text_dest, "a") as file: |
There was a problem hiding this comment.
What's the reason for appending versus write? Could that potentially mean we are getting text from last time? Should be be checking if the file exists first?
There was a problem hiding this comment.
I'll change it tow. I think that's better.
| ] | ||
| response = requests.post(dataprep_ingest_addr, headers=headers, files=files) | ||
| print(response.status_code) | ||
| os.remove(text_dest) |
There was a problem hiding this comment.
If there are situations where we could get an exception, I would put this in a finally block so that we don't end up with lingering files when things fail.
| response = response.json() | ||
| print(response) | ||
| yield (gr.Textbox(visible=True, value="Image ingestion is done. Saving your uploaded image...")) | ||
| time.sleep(2) |
There was a problem hiding this comment.
What's the sleep for? Just wondering if timing could vary by machine and if there's a different way to check for something to be ready.
There was a problem hiding this comment.
I don't know, it's just what they did before 😄 . It's probably for aesthetic reasons. I could try suppressing it and see what it looks like.
There was a problem hiding this comment.
I think this 2 second pause is for the user to have a chance to read the message that ingestion was successful by the megaservice/backend. The next operation (renaming the file in the UI container with the updated unique identifier) will take a very short time, so if there were no time.sleep(2) the next message "Congratulation! Your upload is done!..." would overwrite the other message almost instantly.
| yield ( | ||
| gr.Textbox( | ||
| visible=True, | ||
| value="Something went wrong!\nPlease click the X button on the top right of the image upload box to reupload your image!", |
There was a problem hiding this comment.
Is there more information that we can give on why it failed?
There was a problem hiding this comment.
There's probably a better way. I'll create a ticket for this since it would be a site-wide update.
There was a problem hiding this comment.
Signed-off-by: Melanie Buehler <melanie.h.buehler@intel.com>
Description
This is the corresponding change that goes with mhbuehler/GenAIComps#5. It adds the ability to post a custom caption with an image file to the dataprep service.
Issues
MultimodalQnA Enhancements RFC
Type of change
List the type of change like below. Please delete options that are not relevant.
Dependencies
No new dependencies
Tests
Updated
test_compose_on_xeon.shandtest_compose_on_gaudi.shand added sanity check to READMEs.