GithubHelp home page GithubHelp logo

initml / clipdrop-api-samples Goto Github PK

View Code? Open in Web Editor NEW
431.0 431.0 114.0 24.13 MB

Public samples using the ClipDrop API

Home Page: https://clipdrop.co/apis

License: Apache License 2.0

JavaScript 2.39% HTML 0.83% TypeScript 77.82% CSS 4.72% Swift 8.97% Kotlin 5.27%

clipdrop-api-samples's People

Contributors

benjaminaubin avatar cyrildiagne avatar jblanche avatar juliengenoud avatar sr-tune avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clipdrop-api-samples's Issues

Issue with CLIPDROP API Image Download in Android App

Hi Team,
I am currently using the ClipDrop APIs in my Android application, and I am facing issues with processing the image bytes I receive in the response. I have tried various methods including decoding the bytes into a bitmap and downloading the image via InputStream, but none of them have been successful in generating a usable output image.

When attempting to decode the image bytes into a bitmap using the following code snippet:
val imageInputStream = it.value.body()?.byteStream()
val imageBytes = imageInputStream?.readBytes()
val bitmapImage = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size, null)
The bitmapImage is resulting in null.

Similarly, when I download the image using an InputStream and save it, the downloaded image is corrupted and not viewable on the device.
private fun saveImageAndPreviewOutput(inputStream: InputStream) {
try {
val directory = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "photoLens")
if (!directory.exists()) {
directory.mkdirs()
}
val imageFile = File(directory, "${getUuid()}.png")
FileOutputStream(imageFile).use { output ->
inputStream.copyTo(output)
}
viewModel.outputImagePath = imageFile.toString()
val bundle = Bundle()
outputImageFragment.arguments = bundle
val transaction =
requireActivity().supportFragmentManager.beginTransaction()
.addToBackStack("OutputImageFragment")
.add(R.id.flCameraFragment, outputImageFragment)
transaction.commit()
} finally {
inputStream.close()
}
}

The downloaded image is not opening on the device, and it seems to be corrupted.

Could you please assist me in identifying and resolving the issue? I have attached a sample of the downloaded image for reference.

I have followed the example provided on the GitHub repository for the Android integration, but I am encountering the same issue there as well.

Thanks and regards,
Gourav
+91-9625508164
[email protected]

we can't put the key in the frontend code``

hey ` i have seen the demo on website.

but in React ` we can't put the key in the frontend code so i use the express to post the form data image to your api

and i get a image of binary from the api`` and how i can tranform this format to image in the React?

sketch-to-image return message (The request multipart form is malformed: One of the files in the multipart form is not expected)

hi

env:python 3.9

usage:

img:WX20230912-140459

import requests

r = requests.post('https://clipdrop-api.co/sketch-to-image/v1/sketch-to-image',
  files = {
    'image_file': ('owl-sketch.jpg', image_file_object, 'image/jpeg'),
    },
  data = { 'prompt': 'an owl on a branch, cinematic' },
  headers = { 'x-api-key': 'YOUR_API_KEY'}
)
if (r.ok):
  # r.content contains the bytes of the returned image
else:


  r.raise_for_status()

retrun error message :
The request multipart form is malformed: One of the files in the multipart form is not expected

Please help me find out why there is an error. I'm looking forward to your response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.